﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Xml;
using System.IO;
using System.Reflection;

using InfFront.InfoSources.Base;
using InfFront.InfoSources.ADO;

namespace InfFront.Demo
{
    public partial class RootInfoSource : DummyInfoSource
    {
        public RootInfoSource()
        {
            InitializeComponent();
        }

        public RootInfoSource(IContainer container)
        {
            container.Add(this);

            InitializeComponent();
        }

        private void cmdEditGoodTransaction_OnExecute(object sender, InfoCommandExecArgs args)
        {
            infoGoodTransactions.BeginEdit(args.CurrentEntry);
        }

        private void cmdSleep_OnExecute(object sender, InfoCommandExecArgs args)
        {
            args.Execution.MaxProgress = 10;
            for (int i = 0; i < 10 && !args.Execution.IsCancelled; ++i)
            {
                args.Execution.ProgressMessage = string.Format("{0} left", 10 - i);
                System.Threading.Thread.Sleep(1000);
                args.Execution.Progress = i + 1;
            }
        }
    }
}
